<template>
  <el-row>
    <el-col>
      <el-menu mode="vertical" background-color="#324057" text-color="#fff" active-text-color="#409eff" class="el-menu-vertical-demo">
        <router-link to="/home">
          <el-menu-item index="0">
            <i class="fa fa-margin el-icon-menu"></i>
            <span slot="title">首页</span>
          </el-menu-item>
        </router-link>
        <template v-for="item in items">
          <el-submenu v-if="item.children" :index="item.path" :key="item.path">
            <template slot="title">
              <i :class="'fa fa-margin ' + item.icon"></i>
              <span slot="title">{{ item.name }}</span>
            </template>
            <router-link v-for="(citem, cindex) in item.children" :to="citem.path" :key="cindex">
              <el-menu-item :index="citem.path">
                <span slot="title">{{ citem.name }}</span>
              </el-menu-item>
            </router-link>
          </el-submenu>
        </template>
      </el-menu>
    </el-col>
  </el-row>
</template>
<script>
export default {
  name: "leftmenu",
  data () {
    return {
      items: [
        {
          icon: "el-icon-edit-outline",
          name: "系统用户管理",
          path: "users",
          children: [
            { path: "userList", name: "系统用户管理" },
            { path: "administrator", name: "管理员列表" },
          ],
        },
        {
          icon: "el-icon-edit-outline",
          name: "车辆类型管理",
          path: "type",
          children: [
            { path: "typeCreate", name: "车辆类型添加" },
            { path: "typeManage", name: "车辆类型管理" },
          ],
        },
        {
          icon: "el-icon-edit-outline",
          name: "租赁记录管理",
          path: "rent",
          children: [{ path: "rentList", name: "租赁记录查询" }],
        },
        {
          icon: "el-icon-edit-outline",
          name: "归还记录管理",
          path: "return",
          children: [{ path: "returnManage", name: "归还记录查询" }],
        },
        {
          icon: "el-icon-edit-outline",
          name: "自行车信息管理",
          path: "bike",
          children: [
            { path: "bikeCreate", name: "自行车信息添加" },
            { path: "bikeManage", name: "自行车信息查询" },
          ],
        },
        {
          icon: "el-icon-edit-outline",
          name: "报废数量管理",
          path: "scrap",
          children: [{ path: "scrapNumber", name: "报废数量统计" }],
        },
        {
          icon: "el-icon-edit-outline",
          name: "充值管理",
          path: "money",
          children: [
            { path: "addMoney", name: "用户充值" },
            { path: "recordsMoney", name: "充值记录" },
          ],
        },
      ],
    };
  },
  computed: {
    user () {
      return this.$store.getters.user;
    },
  },
};
</script>
<style scoped>
.menu_page {
  position: fixed;
  top: 71px;
  left: 0;
  min-height: 100%;
  background-color: #324057;
  z-index: 99;
}
.el-menu {
  border: none;
}
.fa-margin {
  margin-right: 5px;
  font-size: 20px;
}
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 180px;
  min-height: 400px;
}
.el-menu-vertical-demo {
  width: 35px;
}
.el-submenu .el-menu-item {
  min-width: 180px;
}

.hiddenDropdown,
.hiddenDropname {
  display: none;
}
a {
  text-decoration: none;
}
</style>
